﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TwitterNameTableAdapters;

public partial class SiteMaster : System.Web.UI.MasterPage
{
    int intuserid,msgall; // int user id, user all msgs
    const int ANONIMUSER = -1; const int ALLUSER = 0;
    MessagesTableAdapter MessageAdapter3 = new MessagesTableAdapter();
    UsersTableAdapter UserAdapter3 = new UsersTableAdapter();


    protected void Page_Load(object sender, EventArgs e)
    {
        string userid1 = HttpContext.Current.User.Identity.Name.ToString();

        NavigationMenu.Items[1].Enabled=false;
        NavigationMenu.Items[3].Enabled=false;
        
        if (!this.IsPostBack)
        {
            if (userid1 == "")
            {
                //off admin,modetaro
                ;
                //GridView1.DataSource = MessageAdapter.GetDataBy_id_for_user(ANONIMUSER);
            }
            else
            {
                ;
               // intuserid = (int)UserAdapter3.ScalarQuery_getUserID(userid1);
                
            }

        }
        Label3.Text ="Twits=" +Convert.ToString((int)MessageAdapter3.ScalarQuery_msgcount())+"/";                
        Label4.Text = " Users=" + Convert.ToString((int)UserAdapter3.ScalarQuery_userscount());
       // HeadLoginView.Label4.Text = "121232";
       // Response.Write(Convert.ToString(msgall));
       /* if (User.Identity.IsAuthenticated)
        {
            Page.Title = "Home page for " + User.Identity.Name;
        }
        else
        {
            Page.Title = "Home page for guest user.";
        }
        
        string usrName = Convert.ToString(Session["UserID"]);*/
        string userid = HttpContext.Current.User.Identity.Name.ToString(); 
        Page.Title = "Sevastopol twitter : "+ Convert.ToString(userid);
        //Label1.Text = userid;
        //Label1.Text = Request.QueryString["id"];

        //MessagesTableAdapter MessageAdapter = new MessagesTableAdapter();
        //GridView GridView1 = new GridView();
        //try
        //{
        //GridView1.DataSource = MessageAdapter.GetDataBy2Anonim();
        //GridView1.DataBind();
        //Response.Write("Значение параметра id = " + Request.QueryString["id"]);
        //}
        //catch (Exception) { ;}
    }
    protected void HeadLoginView_ViewChanged(object sender, EventArgs e)
    {

    }
    protected void LoginView1_ViewChanged(object sender, EventArgs e)
    {

    }
}
